package com.example.intentwithobjecttransfer;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity
{
	private EditText username, password;
	private Button login;
	private Intent intent;
	private Login loging;

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        username = (EditText)findViewById(R.id.username);
        password = (EditText)findViewById(R.id.password);
        login = (Button)findViewById(R.id.login);
        
        loging = new Login(username.getText().toString(), password.getText().toString());
        
        login.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) 
			{
				intent = new Intent(MainActivity.this, Result.class);
				intent.putExtra("login", loging);
				startActivity(intent);
			}
		});
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}
